<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>"> 
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!-- 屏幕自适应 -->
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!-- bootstrap -->
	<link rel="stylesheet" href="shop/public/css/shopCart.css">
	<link rel="stylesheet" href="shop/public/assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="shop/public/css/custom.css">
	<!-- 标题 -->
	<title>桌边零食-随时随地，想购就购~(～￣▽￣)～</title>
  </head>
  
  <body onload="isDisplayUser('<%=request.getSession().getAttribute("username") %>')">
    <div class="head-top">
			<!--导航栏开始-->
			<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
				<div class="container-fluid">
					<!--导航头部(logo)-->
					<div class="navbar-header">
						<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"> 
		                	<span class="icon-bar"></span>
		                    <span class="icon-bar"></span>
		                    <span class="icon-bar"></span> 
	                    </button> 
	                    <a style="color:#f22e00" class="navbar-brand" href="<%=basePath%>index.jsp" ><i>桌边零食</i></a>
					</div>
					<!--导航列表-->
					<div id="navbar-collapse"  >
						<ul class="nav navbar-nav">
							<li class="active">
								<a class="head-a" href="<%=basePath%>index.jsp">首页 <span class="sr-only">(current)</span></a>
							</li>
							<!--用户订单记录(重要) 支付和未支付的-->
							<li class="dropdown">
								<a href="#" class="dropdown-toggle head-a" data-toggle="dropdown" role="button"><span style="color:#f22e00" class="glyphicon glyphicon-inbox"></span> 我的桌边 <span class="caret"></span></a>
								<ul class="dropdown-menu" role="menu">
									<li><a href="#">已买到的零食</a></li><!--已支付已接收的订单-->
									<li class="divider"></li>
									<li><a href="#">最近购物</a></li> 
								</ul>
							</li>
							<!--购物车-->
							<li><a class="head-a" href="cartList?userid=<%=request.getSession().getAttribute("userid") %>&&page=1" ><span style="color:#f22e00" class="glyphicon glyphicon-shopping-cart"></span> 
							购物车 <span id="cartNum" ><%=request.getSession().getAttribute("cartNum") %></span></a>
							</li>
							<!--收藏夹-->
							<li><a class="head-a" href="showTheFav?userid=<%=request.getSession().getAttribute("userid") %>"  role="button" aria-expanded="true"><span style="color:#f22e00" class="glyphicon glyphicon-star"></span> 收藏夹 </a>
							</li>
							<li class="dropdown"><a class="head-a" href="#" href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true"><span style="color:#f22e00" class="glyphicon glyphicon-th-list"></span> 网站导航 <span class="caret"></span></a>
								<ul class="dropdown-menu" role="menu">
									<li role="presentation" class="dropdown-header">休闲零食</li>
						            <li><a href="pageAction!showProductsPage.action?categoryName=坚果炒货&pageIndex=1">坚果炒货</a></li>
						            <li><a href="pageAction!showProductsPage.action?categoryName=梅/果干&pageIndex=1">梅/果干</a></li>
						            <li><a href="pageAction!showProductsPage.action?categoryName=糖果巧克力&pageIndex=1">糖果巧克力</a></li>
						            <li class="divider"></li>
						            <li role="presentation" class="dropdown-header">饼干糕点</li>
						            <!--自定义的菜单样式submenu-->
						            <li class="dropdown-submenu">
						            	<a href="#"  class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">传统糕点  </a>
						            	<ul class="dropdown-menu" role="menu">
						            		<li><a href="pageAction!showProductsPage.action?categoryName=麻薯&pageIndex=1">麻薯</a></li>
								            <li><a href="pageAction!showProductsPage.action?categoryName=凤梨酥&pageIndex=1">凤梨酥</a></li>
								            <li><a href="pageAction!showProductsPage.action?categoryName=黄山烧饼&pageIndex=1">黄山烧饼</a></li>
						            	</ul>

						            </li>
						            <li class="dropdown-submenu">
						            	<a href="#"  class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">西式糕点</a>
						            	<ul class="dropdown-menu" role="menu">
						            		<li><a href="pageAction!showProductsPage.action?categoryName=华夫饼&pageIndex=1">华夫饼</a></li>
								            <li><a href="pageAction!showProductsPage.action?categoryName=铜锣烧&pageIndex=1">铜锣烧</a></li>
								            <li><a href="pageAction!showProductsPage.action?categoryName=牛乳蛋糕&pageIndex=1">牛乳蛋糕</a></li>
						            	</ul> 
						            </li>
						            <li class="divider"></li>
						            <li role="presentation" class="dropdown-header">茶水饮料</li>
						            <li class="dropdown-submenu">
						            	<a href="#"  class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">红茶</a>
						            	<ul class="dropdown-menu" role="menu">
						            		<li><a href="pageAction!showProductsPage.action?categoryName=正山小种&pageIndex=1">正山小种</a></li>
								            <li><a href="pageAction!showProductsPage.action?categoryName=祁门红茶&pageIndex=1">祁门红茶</a></li>
								            <li><a href="pageAction!showProductsPage.action?categoryName=川红&pageIndex=1">川红</a></li>
						            	</ul> 
						            </li>
						            <li class="dropdown-submenu">
						            	<a href="#"  class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">饮料</a>
						            	<ul class="dropdown-menu" role="menu">
						            		<li><a href="pageAction!showProductsPage.action?categoryName=碳酸饮料&pageIndex=1">碳酸饮料</a></li>
								            <li><a href="pageAction!showProductsPage.action?categoryName=即饮咖啡&pageIndex=1">即饮咖啡</a></li>
								            <li><a href="pageAction!showProductsPage.action?categoryName=果味饮料&pageIndex=1">果味饮料</a></li>
						            	</ul> 
						            </li>
						        </ul>
							</li>
						</ul> 
						<!--右边导航栏-->
						<ul class="nav navbar-nav navbar-right">
						
							<!--搜索零食-->
							<form class="navbar-form navbar-left" role="search" action="search">
								<div class="input-group">
									<input type="text" name="search" class="form-control" placeholder="零食传送门....">
									<span class="input-group-btn">
										<button class="btn btn-default" type="sumbit">
											<span style="color:#f22e00" class="glyphicon glyphicon-search"></span> 
											走起！
										</button>
									</span>
								</div>
							</form>
							
							<!--登录后修改为用户名-->
							<li><a class="head-a" id="userLogin" href="shop/Login.jsp"  style="color:#f22e00;display:display;">亲,请先登录!</a></li>
							<li class="dropdown">
								<a id="user" name="user.username" href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" style="color:#f22e00;display:none;">
									<span><img/></span> 
									<%=request.getSession().getAttribute("username") %> 
									<span class="caret"></span>
								</a>
								<ul class="dropdown-menu" role="menu"> 
									<li><a href="shop/Setting.jsp">个人中心</a></li><!-- 用户设置 -->
									<li class="divider"></li>
									<li><a href="quit">退出</a></li><!--用户退出，清除cookie-->
								</ul>
							</li>
						</ul>
					</div>
				</div>
			</nav>
		 
	</div><!--导航栏结束--> 
	
	<div class="container" style="height:inherit;padding-top: 50px;background-color: white;">
		<div class="row clearfix" style="height:100%;">
			<div class="col-md-12 column" > 
				<s:if test="listProduct.size()>0">
				    <!-- 遍历 -->
				    <h2>搜索结果如下:</h2>
					<s:iterator value="listProduct">
						<li class="list-group-item">
							<div class="media">
						 	    <!--商品图片-->
						 		<div class="media-left">
						 			<a style="text-decoration:none;color:black" href="pageAction!showProductInfoAction.action?productId=<s:property value="productid" />"><img src="<s:property value="cover"/>"   alt="照片尚未上传"  style="width:228px; height:171px" class="img-rounded" ></a>
						 		</div>
						   		<!--信息部分-->
							    <div class="media-body">
				                	<h4 class="media-heading" style="font-size:32px;"><a style="text-decoration:none;color:black" href="pageAction!showProductInfoAction.action?productId=<s:property value="productid" />"><s:property value="title"/></a></h4>   <!-- 商品名 -->
				                    	<div style="margin-top:60px;">
									    	<p style="color:636363;font-size:18px">库存：<s:property value="num"/></p><!-- 库存 -->
											<p style="color:ff2400;font-size:23px;font-family:sans-serif;">¥:<s:property value="price"/></p><!-- 价格 -->
									    </div>
				                </div>
						  		<!--信息部分结束-->
						 	</div>
						</li>  
					</s:iterator>
					<s:iterator value="pageProductBean">
					<div>
						<nav>
						  <ul class="pager">
						 	<li>共<s:property value="allRow" />条记录 </li>
							<li>共<s:property value="totalPage" />页 </li>
							<li>当前第<s:property value="currentPage" />页</li>
							<s:if test="%{currentPage == 1}">
								<li class="disabled"><a href="#">第一页</a></li>
								<li class="disabled"><a href="#">上一页</a></li>
							</s:if>
							<s:else>
								<li><a href="search?page=1">第一页</a></li>
								<li><a href="search?page=<s:property value="%{currentPage-1}"/>">上一页</a></li>
							</s:else> 
							<s:if test="%{currentPage != totalPage}" >
								<li><a
									href="search?page=<s:property value="%{currentPage+1}"/>">下一页</a>
								</li>
								<li>
								<a
									href="search?page=<s:property value="totalPage"/>">最后一页</a>
								</li>
							</s:if> 
							<s:else>
							 	<li class="disabled"><a href="#">下一页 </a></li>
							 	<li class="disabled"><a href="#">最后一页 </a></li>    
							</s:else>
						  </ul>
						</nav>
						</div>
					</s:iterator> 
			    </s:if>
				<s:else>
					<div class="container shopCart">
						<div class="row clearfix">
							<div class="col-md-12 column">
								<br/>
								<h4>你的购物车中没有物品</h4>
								<hr/>
								<div class="jumbotron">
									<h1>没有该商品</h1>
								    <p style="text-indent:2em;">装一袋阳光两把海风，自制了几斤祝福，托人到美国买了些快乐，法国买了两瓶浪漫，从心灵的深处切下几许关怀，作为礼物送给你，祝平安快乐~</p>
								</div> 
							</div>
						</div>
					</div>
				</s:else>
			</div>
		</div>
	</div>
	<!-- 购物车结束 -->
	<!-- Javascript -->
	<script src="shop/public/assets/js/jquery-1.11.1.min.js"></script>
	<script src="shop/public/assets/bootstrap/js/bootstrap.min.js"></script> 
	<script src="shop/public/assets/js/retina-1.1.0.min.js"></script>
	<!--修改背景-->
	<script src="shop/public/assets/js/scripts.js"></script>
	<script src="shop/public/assets/js/jquery.backstretch.min.js"></script>
	<!-- 控制出现/消失 -->
	<script src="shop/public/assets/js/user.js"></script>
	<!-- 控制购物车数量 -->
	<script src="shop/public/assets/js/cart.js"></script>
	<!-- 获得购物车中内容 -->
	<script src="shop/public/assets/js/ready.js"></script>
	<!--[if lt IE 10]>
	    <script src="shop/public/assets/js/placeholder.js"></script>
	<![endif]-->
  </body>
</html>
